package com.tang.crm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tang.crm.dto.CustomerDto;
import com.tang.crm.entity.Customer;
import com.tang.crm.vo.CustomerVo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface CustomerMapper extends BaseMapper<Customer> {

    IPage<Map<String, Object>> selectAllByParams(IPage<Customer> page, @Param("params") CustomerDto customerDto);

    Customer selectCustomerByName(@Param("name") String name);

    List<Customer> selectLossCustomers();

    Integer updateCustomerStateByIds(List<Integer> lossCustomerIds);

    // 查询客户的贡献值
    @MapKey("id")
    IPage<Map<String, Object>> selectCustomerContributionByParams(IPage<Map<String, Object>> page, @Param("params") CustomerDto customerDto);

    // 查询客户构成
    @MapKey("id")
    List<Map<String, Object>> countCustomerMake();
}
